<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/sys/account/";  //应用的地址名
String addActionName = basePath+"SysAccount_saveChooseRole.action";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>系统角色表添加</title>
<script type="text/javascript">
<!--
           $(function(){
              //获取已经取得的权限，用于checkbox的值做比较以便进行选中
               var roleids = '<s:iterator value="#request.chooseRoleList" status="role"><s:property value="vcRoleId"/>,</s:iterator>'; 
		       $(':checkbox[name="roleIds"]').each(function(){ 
				       if(roleids.indexOf($(this).val())>=0)
				         $(this).attr("checked", true);  
		          });
               //$('#add').linkbutton();  
	           //点击添加按钮操作
			   $('#addBtn').click(function(){
                  $('#addForm').submit();
	            });
		       //表单验证及提交处理操作
	           $('#addForm').form({
			        url:'<%=addActionName%>',
			        onSubmit: function(){
			                 $.util.showLoading();
			                 $('#operateWindow').window('close');
			        },			        
			        success:function(data){
			            $.util.removeLoading();
                        returnOptMsg(data);
			        }
				});    
		       $('#btnArea').append('<font color=red style="float:left;padding:7px 13px;">双击角色名称可转到角色权限管理界面</font>');
		       $('.role label').dblclick(function(){
		    		top.addTab('角色权限管理','<%=path%>/sys/role/SysRole.action?names='+$(this).text().trim());
		       });
           });
      
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<form id="addForm" method="post" align="center">
  <input type="hidden" name="userId" id=userId value="<s:property value="#parameters.userId"/>">
  <div id="choose" style="width:100%;height:100%;" align=center>
  <div style="width:100%;height:100%;">
  <s:iterator value="#request.allRoleList" status="st">                
    <div class="role" tip="双击转到角色管理界面"><nobr><input type="checkbox" id='r<s:property value="#st.index"/>' name="roleIds" value="<s:property value="vcId"/>"/><label for='r<s:property value="#st.index"/>'><s:property value="vcName"/></label></nobr></div> 
  </s:iterator>
  </div>
  </div>
</form>
<style>
.role{float:left;width:158px;height:20px;overflow:hidden;text-align:left;white-space:nowrap;padding:4px 6px;margin:0px;border-bottom:1px dotted #ccc;}
.role input{margin-right:3px;}
.role label{display:block;width:120px;overflow:hidden;}
.role input,.role label{float:left;line-height:20px;}
</style>
<script type="text/javascript">
$(function(){
	var resizeFun=function(){
		var p=$('#operateWindow'),c=$('#choose>div',p);
		c.width(parseInt(p.width()/170)*170);
	};
	$('#operateWindow').window('options').onResize=resizeFun;
	resizeFun();
});
</script>
</body>
</html>


